# -*- coding: utf-8 -*-
"""
Created on Wed Apr 17 09:58:20 2024

@author: 刘翼
"""

import cv2
import matplotlib.pyplot as plt

image1 = cv2.imread(r"C:\Users\Public\opencv\Figure\bird.jpg")
plt.subplot(2,2,1)
plt.imshow(image1),plt.title('BGR_image')
plt.axis("off")

#BGR色彩空间转RGB色彩空间
img_RGB = cv2.cvtColor(image1,cv2.COLOR_BGR2RGB)
plt.subplot(2,2,2)
plt.imshow(img_RGB),plt.title('RGB_image')
plt.axis("off")


#RGB色彩空间转HSV色彩空间
image2=cv2.cvtColor(img_RGB,cv2.COLOR_RGB2HSV)
plt.subplot(2,2,3)
plt.imshow(image2),plt.title("HSV_image")
plt.axis("off")

#RGB色彩空间转YCrCb色彩空间
image3=cv2.cvtColor(image1,cv2.COLOR_RGB2YCrCb)  
plt.subplot(2,2,4)
plt.imshow(image3),plt.title("YCrCb image")
plt.axis("off")

cv2.waitKey(0)
cv2.destroyAllWindows()